<template>
  <div class="container">
    <img :src="img_base+bg"
         alt=""
         v-if="img_base"
         mode="widthFix"
         class="bg-img">
    <!-- <div class="top">
      <img :src="base_url+'/mp_3.0/bg.png'"
           alt=""
           v-if="base_url"
           class="img"
           mode="widthFix">
      <div class="logo">
        <img :src="base_url+'/mp_3.0/logo.png'"
             v-if="base_url"
             alt=""
             class="logo-icon">
      </div>
    </div>
    <div class="title">
      美亿齿+
    </div>

    <div class="btn-bar">
     
    </div> -->
    <!-- 模态框 -->
    <div class="model bind-tel">
      <button class="tel-btn"
              @tap="get_gift()">查看我的礼品</button>
    </div>
  </div>

</template>


<script>
import common from '@/assets/js/mmk_common.js'
export default {
  data () {
    return {
      base_url: common.image_resource,
      img_base: common.image_response,
      code: "",
      u_id: "",
      login_data: {},
      jump_url: "",
      title: "",
      s_data: {},
      bind_tel: false,
      bg: ""
    };
  },
  methods: {
    get_gift () {
      let s_data = wx.getStorageSync('s_data');
      wx.redirectTo({ url: '/pages/package_mine/card_centry/main' });
    },
    get_detail () {
      let s_data = wx.getStorageSync('s_data');
      wx.showLoading({
        title: "", //提示的内容,
        mask: true, //显示透明蒙层，防止触摸穿透,
        success: res => { }
      });
      common.fly_post("api/act/activity/detail", {
        activity_id: s_data.tg || 105
      }, result => {
        let res = result.data
        wx.hideLoading();
        if (res.status_code == 0) {
          this.bg = res.data.res_img
          console.log(this.bg);

        }
      })
    },
    get_award () {
      let s_data = wx.getStorageSync('s_data');
      console.log("领取奖励", s_data);

      common.fly_post("api/act/activity/receive", {
        activity_id: s_data.tg || 0,
        sid: s_data.sid || 0
      }, result => {
        let res = result.data
        if (res.status_code == 0) {

        } else {
          wx.showToast({
            title: res.message, //提示的内容,
            icon: 'none', //图标,
            duration: 1500, //延迟时间,
            mask: true, //显示透明蒙层，防止触摸穿透,
            success: res => { }
          });
        }
      })
    }
  },
  onLoad () {
    wx.setNavigationBarTitle({
      title: "美亿齿邀请有礼"
    });
    wx.setNavigationBarColor({
      frontColor: '#000000', //前景颜色值，包括按钮、标题、状态栏的颜色，仅支持 #ffffff 和 #000000,
      backgroundColor: '3EB0A9', //背景颜色值，有效值为十六进制颜色,
      success: res => { }
    });
  },
  onShow () {
    this.get_detail()
    this.get_award()
  }
};
</script>

<style lang="less" scoped>
.container {
  width: 100%;
  height: 100%;
  background-color: rgba(216, 216, 216, 1);
  .bg-img {
    width: 100%;
  }
  .model {
    width: 100%;
    background-color: #fff;
    position: absolute;
    bottom: 0;
    left: 0;
    &.bind-tel {
      .tel-btn {
        width: 260px;
        height: 36px;
        background: linear-gradient(
          226deg,
          rgba(254, 120, 161, 1) 0%,
          rgba(254, 123, 136, 1) 100%
        );
        border-radius: 8px;
        font-size: 14px;
        font-family: "PingFangSC-Medium", "PingFang SC";
        font-weight: 500;
        color: rgba(255, 255, 255, 1);
        line-height: 36px;
        text-align: center;
        margin: 59px auto 64px;
      }
    }
  }
}
</style>
